package com.platform.api;

import com.alibaba.fastjson.JSONObject;
import com.platform.annotation.LoginUser;
import com.platform.entity.GiftType;
import com.platform.entity.UserVo;
import com.platform.service.ApiGiftTypeService;
import com.platform.util.ApiBaseAction;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.*;

@Api(tags = "所有礼品")
@RestController
@RequestMapping("/api/giftType")
public class ApiGiftTypeController extends ApiBaseAction {

    private static final Logger logger = LoggerFactory.getLogger(ApiGiftTypeController.class);
    @Autowired
    private ApiGiftTypeService giftTypeService;

    /**
     */
    @ApiOperation(value = "获取礼品列表")
    @PostMapping("list")
    public Object list(@LoginUser UserVo loginUser) {
        logger.info("【请求开始】获取所有礼品接口,请求参数:{}", JSONObject.toJSONString(loginUser));

        List<GiftType> giftTypeList = giftTypeService.queryList();

        logger.info("【请求结束】获取所有礼品接口,响应结果:{}", giftTypeList);
        return this.toResponsSuccess(giftTypeList);
    }
}
